package com.alexgaoyh.MutiModule.Dubbo.RWSeperate.provider.write.mutiDatabase;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.api.mutiDatabase.write.IMutiDatabaseWriteService;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.mutiDatabase.MutiDatabase;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.mutiDatabase.MutiDatabaseExample;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.persist.mutiDatabase.MutiDatabaseMapper;

@Service(value = "mutiDatabaseService")
public class MutiDatabaseServiceImpl implements IMutiDatabaseWriteService{

	@Resource(name = "mutiDatabaseMapper")
	private MutiDatabaseMapper mapper;
	
	@Override
	public int insert(MutiDatabase record) {
		return mapper.insert(record);
	}

	@Override
	public int insertSelective(MutiDatabase record) {
		return mapper.insertSelective(record);
	}

	@Override
	public int insertTransaction(MutiDatabase record1, MutiDatabase record2) {
		int record1Int = mapper.insert(record1);
		int record2Int = mapper.insert(record2);
		if((record1Int == 1) && (record2Int == 1)) {
			return 1;
		}else {
			return 0;
		}
	}

	@Override
	public int updateByExampleSelective(MutiDatabase record,
			MutiDatabaseExample example) {
		return mapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(MutiDatabase record, MutiDatabaseExample example) {
		return mapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKeySelective(MutiDatabase record) {
		return mapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(MutiDatabase record) {
		return mapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int deleteByExample(MutiDatabaseExample example) {
		return mapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(Long id) {
		return mapper.deleteByPrimaryKey(id);
	}

}
